import numpy
import scipy

from playLA.Vector import Vector

if __name__ == '__main__':
    vec = Vector([5, 2])
    print(vec)
    print(len(vec))
    print(vec[0], vec[1])

    vec2 = Vector([4, 9])
    print('{} + {} = {}'.format(vec, vec2, vec+vec2))
    print('{} - {} = {}'.format(vec, vec2, vec - vec2))
    print('{} * {} = {}'.format(3, vec, 3 * vec))
    print('{} * {} = {}'.format(5, vec2, 5 * vec2))

    print('+{} = {}'.format(vec2, +vec2))
    print('-{} = {}'.format(vec2, -vec2))

    zero2 = Vector.zero(2)
    print('{}'.format(zero2 + vec2))

    print('norm({}) = {}'.format(vec2, vec2.norm()))
    print('norm({}) = {}'.format(zero2, zero2.norm()))

    print('normalize({}) = {}'.format(vec, vec.normalize()))
    print('normalize({}) = {}'.format(vec2, vec2.normalize()))
    print(vec.normalize().norm())

    try:
        print('normalize({}) = {}'.format(zero2, zero2.normalize()))
    except ZeroDivisionError:
        print('Cannot normalize zero vector{}'.format(zero2))

    vec3 = Vector([0, 0])
    print('{} == {} ? {}'.format(zero2, vec3, vec3 == zero2))
    print('{} == {} ? {}'.format(zero2, vec3, vec3 == vec2))
    print('{} == {} ? {}'.format(zero2, vec3, vec3 != zero2))

